
#The only real purpose of this is to ensure that
#the creation, and input/output of the scan events
#is working correctly.


from ScanEvent import ScanEvent
from ScanEvent import EmailItem
from ScanEvent import getPathToSaves
from ScanEvent import saveScanEvent
from ScanEvent import loadScanEvent
'''
#Test EmailItem Stuff
emailItem1 = EmailItem()
emailItem2 = EmailItem()
emailItem3 = EmailItem()
emailItem4 = EmailItem()
testListOfEmailItems = [emailItem1, emailItem2, emailItem3, emailItem4]

#Test Report stuff
#The reports are a dict where:
    #key: name of customer report 
    #value: the directory path of the report.
testReportDict = {"Name1" : "c:/blah/Blah1", "Name2" : "c:/blah/Blah2"}

#The schedule is also a dictionary where the keys are strings
#and the corresponding values are strings.
#I don't know if the schedule is more defined than ths yet, so
#I'm just treating the keys and the values as arbitrary strings.
testScheduleDict = {"SchedKey1":"Schedval1", "SchedKey2":"SchedVal2"}


#We create the scan event and set its members
testScanEventToDisk = ScanEvent()
testScanEventToDisk.setEmailItems(testListOfEmailItems)
testScanEventToDisk.setName("testScanEventToDiskDSH")
testScanEventToDisk.setPolicy("atDSHTRYINGCRAPOUT_POLICY")
testScanEventToDisk.setReports(testReportDict)
testScanEventToDisk.setSchedule(testScheduleDict)
testScanEventToDisk.setTargets("127.0.0.1, localhost")
testScanEventToDisk.setTimeToWait(4)
testScanEventToDisk.setUUID(100100100100)
testScanEventToDisk.setScansToKeep(2)
testScanEventToDisk.setScannerName("AtDSHRIGHTNOWWORKINGSCANNER")


#Now we serialize the testScanEvent to file
scansDir = getPathToSaves()
saveScanEvent(testScanEventToDisk, scansDir)


#Now that it is saved to disk, lets see if we can reload it
#Then we will save it again to make sure variables persisted.
testScanEventFromDisk = loadScanEvent("testScanEventToDiskDSH.se")

#Now we have loaded the 'to disk' from disk 
#and we are writing it back to disk testing the plumming.
#Essentially tests of to/from methods are successful if the two 
# .se files "testScanEventToDisk.se" and "testScanEventToDiskAgain.se"
#are exact.
testScanEventFromDisk.setName("testScanEventToDiskAgain")
saveScanEvent(testScanEventFromDisk,scansDir)
'''